package com.lagou.controller;

import com.lagou.service.ArticleService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Mrwg
 * @date 2020/4/23
 * @description
 */
@Controller
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @RequestMapping(value = "/index",method= RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value="查询博客列表", notes="查询博客列表")
    public ModelAndView list(Model model, HttpServletRequest req, HttpServletResponse resp) {
        model.addAttribute("article", articleService.findAll());
        return new ModelAndView("client/index");
    }
}
